
<template>
  <div class="parent">
    <Table :columns="textColumns" :list="textAuditList" :tableId="'text'" :update-func="updateFunc">
      <template #pagination>
        <el-pagination layout="prev, pager, next, jumper" :total="textAuditTotal" :page-size="textAuditSize"
          @current-change="handleCurrentChange" />
      </template>
    </Table>
  </div>
</template>
<script lang="ts" setup>
import Table from '@/components/table/Table.vue'
import { GetText } from '@/vendors/textContent/textContent';
import useSetting from '@/vendors/store/setting'
import { watch } from 'vue'
const {
  textAuditTotal,
  textAuditList,
  textAuditPage,
  getTextList,
  textColumns,
  textAuditSize
} = GetText()
getTextList()
const handleCurrentChange = (value: number) => {
  textAuditPage.value = value
  getTextList()
}
const setting = useSetting()
const updateFunc = () => {
  textAuditPage.value -= 1
  // 减少数量
  // setting.setUserAlbumVideoCount(setting.count[3].num - 1)
  getTextList()
}
watch(() => setting.refreshCount, () => {
  if (setting.refreshCount) {
    // 需要刷新当前页
    const len = textAuditList.value.length
    const flag = len !=0  && len % textAuditSize.value == 0  // 列表是整10倍数
    if (!flag) {
      // 非整10倍数
      textAuditPage.value -= 1
      getTextList()
    }
    setting.setRefreshCount(!setting.refreshCount)
  }
})
</script>
<style scoped lang="scss">
.parent {
  background: white;
  padding: 32px 48px;
  border-radius: 16px;
  box-shadow: -3px 0 4px 1px #0000001A, 3px 0 4px 1px #0000001A;
}
</style>